continuation passing style - définition. Qu'est-ce que continuation passing style
Diclib.com
Dictionnaire ChatGPT
Entrez un mot ou une phrase dans n'importe quelle langue 👆
Langue:

Traduction et analyse de mots par intelligence artificielle ChatGPT

Sur cette page, vous pouvez obtenir une analyse détaillée d'un mot ou d'une phrase, réalisée à l'aide de la meilleure technologie d'intelligence artificielle à ce jour:

  • comment le mot est utilisé
  • fréquence d'utilisation
  • il est utilisé plus souvent dans le discours oral ou écrit
  • options de traduction de mots
  • exemples d'utilisation (plusieurs phrases avec traduction)
  • étymologie

Qu'est-ce (qui) est continuation passing style - définition

PROGRAMMING STYLE
Continuation passing style; CPS conversion; Direct style; Continuation passing; Continuation Passing Style; Continuation-passing

Continuation-passing style         
In functional programming, continuation-passing style (CPS) is a style of programming in which control is passed explicitly in the form of a continuation. This is contrasted with direct style, which is the usual style of programming.
Continuation Passing Style         
(CPS) A semantically clean language with continuations used as an intermediate language for Scheme and the SML/NJ compiler. ["Rabbit: A Compiler for Scheme", G.L. Steele, AI-TR-474, MIT (May 1978)]. ["Compiling With Continuations", A. Appel, Cambridge U Press 1992].
continuation passing style         
<programming> (CPS) A style of programming in which every user function f takes an extra argument c known as a continuation. Whenever f would normally return a result r to its caller, it instead returns the result of applying the continuation to r. The continuation thus represents the whole of the rest of the computation. Some examples: normal (direct style) --> continuation passing square x = x * x square x k = k (x*x) g (square 23) square 23 g (square 3) + 1 square 3 ( s . s+1 ) (1995-04-04)

Wikipédia

Continuation-passing style

In functional programming, continuation-passing style (CPS) is a style of programming in which control is passed explicitly in the form of a continuation. This is contrasted with direct style, which is the usual style of programming. Gerald Jay Sussman and Guy L. Steele, Jr. coined the phrase in AI Memo 349 (1975), which sets out the first version of the Scheme programming language.John C. Reynolds gives a detailed account of the numerous discoveries of continuations.

A function written in continuation-passing style takes an extra argument: an explicit "continuation"; i.e., a function of one argument. When the CPS function has computed its result value, it "returns" it by calling the continuation function with this value as the argument. That means that when invoking a CPS function, the calling function is required to supply a procedure to be invoked with the subroutine's "return" value. Expressing code in this form makes a number of things explicit which are implicit in direct style. These include: procedure returns, which become apparent as calls to a continuation; intermediate values, which are all given names; order of argument evaluation, which is made explicit; and tail calls, which simply call a procedure with the same continuation, unmodified, that was passed to the caller.

Programs can be automatically transformed from direct style to CPS. Functional and logic compilers often use CPS as an intermediate representation where a compiler for an imperative or procedural programming language would use static single assignment form (SSA). SSA is formally equivalent to a subset of CPS (excluding non-local control flow, which does not occur when CPS is used as intermediate representation). Functional compilers can also use A-normal form (ANF) (but only for languages requiring eager evaluation), rather than with 'thunks' (described in the examples below) in CPS. CPS is used more frequently by compilers than by programmers as a local or global style.